import {
  createRouter,
  createWebHistory
} from 'vue-router'
import Home from '../views/Home'

// 路由列表
const routes = [{
  path: '/home',
  name: 'Home',
  component: Home
}, {
  path: '/',
  redirect: '/home'
}, {
  name: 'Articles',
  path: '/articles',
  component: () => import('@/views/article/Articles')
}, {
  name: 'article',
  path: '/article/:articleId',
  component: () => import('@/views/article/ArticleDetail')
}, {
  name: 'Tag',
  path: '/tags',
  component: () => import('@/views/tag/Tags')
}, {
  name: 'Timeline',
  path: '/timeline',
  component: () => import('@/views/article/Timeline')
}, {
  name: 'Friends',
  path: '/friends',
  component: () => import('@/views/Friends')
}, {
  name: 'About',
  path: '/about',
  component: () => import('@/views/About')
}, {
  name: 'UnFinished',
  path: '/unFinished',
  component: () => import('@/views/UnFinished')
}, {
  name: '404',
  path: '/404',
  component: () => import('@/views/404')
}, {
  // 404页面配置 这个必须在最下面
  path: '/:catchAll(.*)',
  redirect: '/404'
}]

const router = createRouter({
  history: createWebHistory("/"),
  routes
})

export default router